$('document').ready(function(){	
	//calender
	$('#popen').datepicker({showButtonPanel: true});
	$('#popen').datepicker('option', {dateFormat: 'dd/mm/yy'});
	$('#pclosed').datepicker({showButtonPanel: true});
	$('#pclosed').datepicker('option', {dateFormat: 'dd/mm/yy'});

	//ckditor description
	$( 'textarea#pdescription' ).ckeditor();
	//validate form edit
	$('#frmEdit').validate({
            errorClass      : 'error',
            errorElement	: 'span',
    		onfocusout		: false,
    		onkeyup			: false,
    		ignore			: 'input[type="text"]:hidden',
			rules:{
				pname:{
					required:true,
					minlength:VL_NAME_MINLENGTH,
					maxlength:VL_NAME_STADIUM_MAXLENGTH
				},
				pshort:{
					required: true,
					minlength:VL_NAME_MINLENGTH,
					maxlength:VL_NAME_STADIUM_MAXLENGTH
				},
				pdescription:{
					required:true,
					minlength:VL_CONTENT_MINLENGTH,
					/*maxlength:2*/
				},
				popen:{
					required:true,
					/*minlength:2,
					maxlength:2*/
				},
                pclosed:{
                    required: true,
                },
			},
			messages:{
				pname:{
					required:name_required,
					minlength:name_minlength,
					maxlength:name_maxlength
				},
				pshort:{
					required: short_required,
					minlength:name_minlength,
					maxlength:name_maxlength
				},
				pdescription:{
					required:description_required,
					minlength:description_minlength,
					/*maxlength:2*/
				},
				popen:{
					required:date_required,
				},
                pclosed:{
                    required: date_required,
                },
			},
			errorPlacement: function(error, element) {
			       error.insertAfter(element); // change this to place error message elsewhere
			}			
	});
});

